﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>获取节点信息</title>
    <script>
        function start() {
            myDocumentElements = document.getElementsByTagName("body");
            myBody = myDocumentElements.item(0);

            myBodyElements = myBody.getElementsByTagName("p");
            myP = myBodyElements.item(1);
        }
    </script>
</head>
<body onload="start()">
    <p>你好!</p>
    <p>欢迎光临!</p>
</body>
</html>